import { GBox } from "../../../../com/mui/containers/GBox";
import { GBoxDirection } from "../../../../com/mui/containers/globalVariable/GBoxDirection";
import { GScrollPane } from "../../../../com/mui/controls/GScrollPane";
import { ScrollPolicy } from "../../../../fl/controls/ScrollPolicy";
import { WelGiftItem } from "./welfare/WelGiftItem";
type int = number;
//class Mall360Gift
    
    export  class Mall360Gift /* flash.display.Sprite */
    {
        constructor(arg1: int, arg2: int)
        {
            
            this._width = arg1;
            this._height = arg2;
            this.initUI();
            return;
        }

        protected initUI(): void
        {
            this._bodySprite = new GBox();
            this._bodySprite.direction = GBoxDirection.VERTICAL;
            this._scrollPane = new GScrollPane();
            this._scrollPane.x = 0;
            this._scrollPane.y = 0;
            this._scrollPane.width = this.width;
            this._scrollPane.height = this.height;
            this._scrollPane.styleName = "GScrollPane";
            this._scrollPane.verticalScrollPolicy = ScrollPolicy.AUTO;
            this._scrollPane.horizontalScrollPolicy = ScrollPolicy.OFF;
            this._scrollPane.source = this._bodySprite;
            this._scrollPane.scrollDrag = false;
            this._scrollPane.focusEnabled = false;
            addChild(this._scrollPane);
            this._gift1 = new WelGiftItem();
            this._gift1.x = 0;
            this._gift1.y = 0;
            this._bodySprite.addChild(this._gift1);
            this._gift2 = new WelGiftItem();
            this._gift2.x = this._gift1.x;
            this._gift2.y = this._gift1.y + this._gift1.height + 2;
            this._bodySprite.addChild(this._gift2);
            this._gift3 = new WelGiftItem();
            this._gift3.x = this._gift2.x;
            this._gift3.y = this._gift2.y + this._gift2.height + 2;
            this._bodySprite.addChild(this._gift3);
            return;
        }

        public updateData(arg1: Array<any>): void
        {
            if (arg1.length != 3) 
            {
                if (arg1.length == 2) 
                {
                    this._gift1.updateData(arg1[0]);
                    this._gift2.updateData(arg1[1]);
                    if (this._gift3.parent) 
                    {
                        this._gift3.parent.removeChild(this._gift3);
                    }
                }
            }
            else 
            {
                this._gift1.updateData(arg1[0]);
                this._gift2.updateData(arg1[1]);
                this._gift3.updateData(arg1[2]);
                if (!this._gift3.parent) 
                {
                    this._bodySprite.addChild(this._gift3);
                }
            }
            this._bodySprite.invalidate();
            this._scrollPane.refreshPane();
            this._scrollPane.update();
            return;
        }

        public dispose(): void
        {
            return;
        }

        public /* override */ get width(): number
        {
            return this._width;
        }

        public /* override */ get height(): number
        {
            return this._height;
        }

        /* internal */ /* var */_gift1: WelGiftItem;

        /* internal */ /* var */_gift2: WelGiftItem;

        /* internal */ /* var */_gift3: WelGiftItem;

        /* internal */ /* var */_bodySprite: GBox;

        /* internal */ /* var */_scrollPane: GScrollPane;

        /* internal */ /* var */_width: int;

        /* internal */ /* var */_height: int;
    }
